Fix case sorting in alpha sort functions
authorJustin Burkett <justin@burkett.cc>
Wed, 12 Feb 2020 14:23:18 +0000 (09:23 -0500)
committerJustin Burkett <justin@burkett.cc>
Wed, 12 Feb 2020 14:23:18 +0000 (09:23 -0500)
which-key-tests.el
which-key.el

index 81797975184fdcedee4ce1deb4810f350d38be00..ae015bec6ef233c60741105a5b0fef5ecfcd9e65 100644 (file)
       (should
        (equal
         (mapcar 'car (sort (copy-sequence keys) 'which-key-key-order-alpha))
-        '("SPC" "a" "A" "b" "B" "p" "C-a"))))
+        '("SPC" "A" "a" "B" "b" "p" "C-a"))))
     (let (which-key-sort-uppercase-first)
       (should
        (equal
         (mapcar 'car (sort (copy-sequence keys) 'which-key-key-order-alpha))
-        '("SPC" "A" "a" "B" "b" "p" "C-a"))))
+        '("SPC" "a" "A" "b" "B" "p" "C-a"))))
     (let ((which-key-sort-uppercase-first t))
       (should
        (equal
index d0a28a10589f3af152fd603cac0223d47a9135aa..e5127eefdbef552bae9fda5402debd8936bd19f6 100644 (file)
@@ -1321,11 +1321,11 @@ width) in lines and characters respectively."
     (cond
      ((and alpha (not which-key-sort-uppercase-first))
       (if (string-equal da db)
-          (string-lessp a b)
+          (not (string-lessp a b))
         (string-lessp da db)))
      ((and alpha which-key-sort-uppercase-first)
       (if (string-equal da db)
-          (not (string-lessp a b))
+          (string-lessp a b)
         (string-lessp da db)))
      ((not which-key-sort-uppercase-first)
       (let ((aup (not (string-equal da a)))